using System;
using System.Data;

namespace MetaView.Core;

internal class DataSetFastBinaryConverter : FastBinaryConverter<DataSet>
{
    protected override DataSet Read<TByteBlock>(ref TByteBlock byteBlock, Type type)
    {
        return SerializeConvert.BinaryDeserialize<DataSet>(byteBlock.ReadBytesPackage());
    }

    protected override void Write<TByteBlock>(ref TByteBlock byteBlock, in DataSet obj)
    {
        var bytes = SerializeConvert.BinarySerialize(obj);
        byteBlock.WriteBytesPackage(bytes);
    }
}